<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Calico: calico/trajectory.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Calico
   </div>
   <div id="projectbrief">A visual-inertial calibration library designed for rapid problem construction and debugging.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_e7ac338090e46d594d3ea7a0e9efc7ba.html">calico</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">trajectory.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef CALICO_TRAJECTORY_H_</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define CALICO_TRAJECTORY_H_</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160; </div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &quot;absl/container/flat_hash_map.h&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &quot;absl/status/status.h&quot;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &quot;calico/bspline.h&quot;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;calico/typedefs.h&quot;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;ceres/problem.h&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &quot;ceres/rotation.h&quot;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160; </div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160; </div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacecalico.html">calico</a> {</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160; </div>
<div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="structcalico_1_1TrajectoryEvaluationParams.html">   14</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structcalico_1_1TrajectoryEvaluationParams.html">TrajectoryEvaluationParams</a> {</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;  <span class="keywordtype">int</span> spline_index;</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;  <span class="keywordtype">double</span> knot0;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;  <span class="keywordtype">double</span> knot1;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;  <span class="keywordtype">double</span> stamp;</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;  <span class="keywordtype">int</span> num_control_points;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;  Eigen::MatrixXd basis_matrix;</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;};</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="classcalico_1_1Trajectory.html">   25</a></span>&#160;<span class="keyword">class </span><a class="code" href="classcalico_1_1Trajectory.html">Trajectory</a> {</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="classcalico_1_1Trajectory.html#a24009abb70b9197145dfeb5e6f589b51">   28</a></span>&#160;  <span class="keyword">static</span> constexpr <span class="keywordtype">int</span> <a class="code" href="classcalico_1_1Trajectory.html#a24009abb70b9197145dfeb5e6f589b51">kDefaultSplineOrder</a> = 6;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="classcalico_1_1Trajectory.html#ab50b8748cad2ad68a9e3800a56a14aa8">   31</a></span>&#160;  <span class="keyword">static</span> constexpr <span class="keywordtype">double</span> <a class="code" href="classcalico_1_1Trajectory.html#ab50b8748cad2ad68a9e3800a56a14aa8">kDefaultKnotFrequency</a> = 10;</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160; </div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;  absl::Status <a class="code" href="classcalico_1_1Trajectory.html#a68f4f44651441e3d77bb13cd5b07cce7">FitSpline</a>(</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;      <span class="keyword">const</span> absl::flat_hash_map&lt;double, Pose3d&gt;&amp; poses_world_sensorrig,</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;      <span class="keywordtype">double</span> knot_frequency = <a class="code" href="classcalico_1_1Trajectory.html#ab50b8748cad2ad68a9e3800a56a14aa8">kDefaultKnotFrequency</a>,</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;      <span class="keywordtype">int</span> spline_order = <a class="code" href="classcalico_1_1Trajectory.html#a24009abb70b9197145dfeb5e6f589b51">kDefaultSplineOrder</a>);</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  <span class="keywordtype">int</span> <a class="code" href="classcalico_1_1Trajectory.html#a7b3008b06c6bb5e9480a3131ad8a3f13">AddParametersToProblem</a>(ceres::Problem&amp; problem);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="classcalico_1_1Trajectory.html#abce44ba657a445b2a73988c4788f0240">   67</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classcalico_1_1BSpline.html">BSpline&lt;6&gt;</a>&amp; <a class="code" href="classcalico_1_1Trajectory.html#abce44ba657a445b2a73988c4788f0240">spline</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> spline_pose_world_body_; }</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;  <a class="code" href="classcalico_1_1BSpline.html">BSpline&lt;6&gt;</a>&amp; <a class="code" href="classcalico_1_1Trajectory.html#abce44ba657a445b2a73988c4788f0240">spline</a>() { <span class="keywordflow">return</span> spline_pose_world_body_; }</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160; </div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;  absl::StatusOr&lt;std::vector&lt;Pose3d&gt;&gt;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;  <a class="code" href="classcalico_1_1Trajectory.html#ac20a0fc8fb0aabd138d34dd2935c8cf2">Interpolate</a>(<span class="keyword">const</span> std::vector&lt;double&gt;&amp; interp_times) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160; </div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="classcalico_1_1Trajectory.html#a60aa4cc5ee41e985c83259612e036530">   94</a></span>&#160;  <span class="keyword">static</span> <a class="code" href="classcalico_1_1Pose3.html">Pose3&lt;T&gt;</a> <a class="code" href="classcalico_1_1Trajectory.html#a60aa4cc5ee41e985c83259612e036530">VectorToPose3</a>(<span class="keyword">const</span> Eigen::Vector&lt;T, 6&gt;&amp; vector) {</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    <span class="keyword">const</span> Eigen::Vector3&lt;T&gt; phi = vector.head(3);</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    <span class="keyword">const</span> Eigen::Vector3&lt;T&gt; pos = vector.tail(3);</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    Eigen::Vector4&lt;T&gt; q;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    ceres::AngleAxisToQuaternion(phi.data(), q.data());</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <span class="keyword">const</span> Eigen::Quaternion&lt;T&gt; rot(q(0), q(1), q(2), q(3));</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classcalico_1_1Pose3.html">Pose3&lt;T&gt;</a>(rot, pos);</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;  }</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160; </div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;  <span class="keyword">const</span> absl::flat_hash_map&lt;double, Pose3d&gt;&amp; <a class="code" href="classcalico_1_1Trajectory.html#a03de815880e8367a6c110dace3b20090">trajectory</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;  absl::flat_hash_map&lt;double, Pose3d&gt;&amp; <a class="code" href="classcalico_1_1Trajectory.html#a03de815880e8367a6c110dace3b20090">trajectory</a>();</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160; </div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;  <a class="code" href="structcalico_1_1TrajectoryEvaluationParams.html">TrajectoryEvaluationParams</a> <a class="code" href="classcalico_1_1Trajectory.html#ad402e9a34842a3cf98e944415868a7e5">GetEvaluationParams</a>(<span class="keywordtype">double</span> stamp) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160; </div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;  absl::flat_hash_map&lt;double, Pose3d&gt; pose_id_to_pose_world_body_;</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;  <a class="code" href="classcalico_1_1BSpline.html">BSpline&lt;6&gt;</a> spline_pose_world_body_;</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160; </div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;  <span class="comment">// Convenience function for unwrapping discrete axis-angle vectors in order to</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  <span class="comment">// get a more continuous signal.</span></div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;  <span class="keywordtype">void</span> UnwrapPhaseLogMap(std::vector&lt;Eigen::Vector3d&gt;&amp; phi);</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160; </div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;};</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;} <span class="comment">// namespace calico</span></div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160; </div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="preprocessor">#endif </span><span class="comment">//CALICO_TRAJECTORY_H_</span></div>
<div class="ttc" id="aclasscalico_1_1BSpline_html"><div class="ttname"><a href="classcalico_1_1BSpline.html">calico::BSpline&lt; 6 &gt;</a></div></div>
<div class="ttc" id="aclasscalico_1_1Pose3_html"><div class="ttname"><a href="classcalico_1_1Pose3.html">calico::Pose3</a></div><div class="ttdef"><b>Definition:</b> typedefs.h:39</div></div>
<div class="ttc" id="aclasscalico_1_1Trajectory_html"><div class="ttname"><a href="classcalico_1_1Trajectory.html">calico::Trajectory</a></div><div class="ttdef"><b>Definition:</b> trajectory.h:25</div></div>
<div class="ttc" id="aclasscalico_1_1Trajectory_html_a03de815880e8367a6c110dace3b20090"><div class="ttname"><a href="classcalico_1_1Trajectory.html#a03de815880e8367a6c110dace3b20090">calico::Trajectory::trajectory</a></div><div class="ttdeci">const absl::flat_hash_map&lt; double, Pose3d &gt; &amp; trajectory() const</div><div class="ttdoc">Setter/getter for the internal map between timestamp and pose.</div><div class="ttdef"><b>Definition:</b> trajectory.cpp:55</div></div>
<div class="ttc" id="aclasscalico_1_1Trajectory_html_a24009abb70b9197145dfeb5e6f589b51"><div class="ttname"><a href="classcalico_1_1Trajectory.html#a24009abb70b9197145dfeb5e6f589b51">calico::Trajectory::kDefaultSplineOrder</a></div><div class="ttdeci">static constexpr int kDefaultSplineOrder</div><div class="ttdoc">Default spline order of 6.</div><div class="ttdef"><b>Definition:</b> trajectory.h:28</div></div>
<div class="ttc" id="aclasscalico_1_1Trajectory_html_a60aa4cc5ee41e985c83259612e036530"><div class="ttname"><a href="classcalico_1_1Trajectory.html#a60aa4cc5ee41e985c83259612e036530">calico::Trajectory::VectorToPose3</a></div><div class="ttdeci">static Pose3&lt; T &gt; VectorToPose3(const Eigen::Vector&lt; T, 6 &gt; &amp;vector)</div><div class="ttdef"><b>Definition:</b> trajectory.h:94</div></div>
<div class="ttc" id="aclasscalico_1_1Trajectory_html_a68f4f44651441e3d77bb13cd5b07cce7"><div class="ttname"><a href="classcalico_1_1Trajectory.html#a68f4f44651441e3d77bb13cd5b07cce7">calico::Trajectory::FitSpline</a></div><div class="ttdeci">absl::Status FitSpline(const absl::flat_hash_map&lt; double, Pose3d &gt; &amp;poses_world_sensorrig, double knot_frequency=kDefaultKnotFrequency, int spline_order=kDefaultSplineOrder)</div><div class="ttdef"><b>Definition:</b> trajectory.cpp:14</div></div>
<div class="ttc" id="aclasscalico_1_1Trajectory_html_a7b3008b06c6bb5e9480a3131ad8a3f13"><div class="ttname"><a href="classcalico_1_1Trajectory.html#a7b3008b06c6bb5e9480a3131ad8a3f13">calico::Trajectory::AddParametersToProblem</a></div><div class="ttdeci">int AddParametersToProblem(ceres::Problem &amp;problem)</div><div class="ttdef"><b>Definition:</b> trajectory.cpp:51</div></div>
<div class="ttc" id="aclasscalico_1_1Trajectory_html_ab50b8748cad2ad68a9e3800a56a14aa8"><div class="ttname"><a href="classcalico_1_1Trajectory.html#ab50b8748cad2ad68a9e3800a56a14aa8">calico::Trajectory::kDefaultKnotFrequency</a></div><div class="ttdeci">static constexpr double kDefaultKnotFrequency</div><div class="ttdoc">Default knot frequency at 10Hz.</div><div class="ttdef"><b>Definition:</b> trajectory.h:31</div></div>
<div class="ttc" id="aclasscalico_1_1Trajectory_html_abce44ba657a445b2a73988c4788f0240"><div class="ttname"><a href="classcalico_1_1Trajectory.html#abce44ba657a445b2a73988c4788f0240">calico::Trajectory::spline</a></div><div class="ttdeci">const BSpline&lt; 6 &gt; &amp; spline() const</div><div class="ttdoc">Accessors for the spline.</div><div class="ttdef"><b>Definition:</b> trajectory.h:67</div></div>
<div class="ttc" id="aclasscalico_1_1Trajectory_html_ac20a0fc8fb0aabd138d34dd2935c8cf2"><div class="ttname"><a href="classcalico_1_1Trajectory.html#ac20a0fc8fb0aabd138d34dd2935c8cf2">calico::Trajectory::Interpolate</a></div><div class="ttdeci">absl::StatusOr&lt; std::vector&lt; Pose3d &gt; &gt; Interpolate(const std::vector&lt; double &gt; &amp;interp_times) const</div><div class="ttdef"><b>Definition:</b> trajectory.cpp:96</div></div>
<div class="ttc" id="aclasscalico_1_1Trajectory_html_ad402e9a34842a3cf98e944415868a7e5"><div class="ttname"><a href="classcalico_1_1Trajectory.html#ad402e9a34842a3cf98e944415868a7e5">calico::Trajectory::GetEvaluationParams</a></div><div class="ttdeci">TrajectoryEvaluationParams GetEvaluationParams(double stamp) const</div><div class="ttdoc">Get the parameters needed to evaluate the spline for a given timestamp.</div><div class="ttdef"><b>Definition:</b> trajectory.cpp:63</div></div>
<div class="ttc" id="anamespacecalico_html"><div class="ttname"><a href="namespacecalico.html">calico</a></div><div class="ttdoc">Primary calico namespace.</div><div class="ttdef"><b>Definition:</b> __init__.py:1</div></div>
<div class="ttc" id="astructcalico_1_1TrajectoryEvaluationParams_html"><div class="ttname"><a href="structcalico_1_1TrajectoryEvaluationParams.html">calico::TrajectoryEvaluationParams</a></div><div class="ttdef"><b>Definition:</b> trajectory.h:14</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
